home *** CD-ROM | disk | FTP | other *** search
/ Borland JBuilder 6 / jbuilder6.iso / Documents / JAVA Programming / examples / 12 / Enum.class (.txt) < prev    next >
Encoding:
Java Class File  |  2000-09-08  |  582 b   |  20 lines

  1. import java.util.Enumeration;
  2.  
  3. class Enum implements Enumeration {
  4.    private int count;
  5.    private boolean more = true;
  6.  
  7.    public boolean hasMoreElements() {
  8.       return this.more;
  9.    }
  10.  
  11.    public Object nextElement() {
  12.       ++this.count;
  13.       if (this.count > 4) {
  14.          this.more = false;
  15.       }
  16.  
  17.       return new Integer(this.count);
  18.    }
  19. }
  20.